<template>
  <su-page bg="#f7f7f7">
    <su-body>
      <!-- header -->
      <su-white-header v-if="detailData" :title="detailData.gcmc" :prop="detailData.dizhi"></su-white-header>
      <!-- detail -->
      <su-prop-group title="基本信息" v-if="detailData">
        <su-prop label="工程状态">{{detailData.zhuangtai || ''}}</su-prop>
		<su-prop label="开工时间">{{detailData.kgsj || ''}}</su-prop>
        <su-prop label="建设单位">{{detailData.jsdw || ''}}</su-prop>
        <su-prop label="总包企业">{{detailData.zbqy || ''}}</su-prop>
        <su-prop label="项目经理">{{detailData.zbfzr || ''}}</su-prop>
		<su-prop label="经理电话">{{detailData.lxfs || ''}}</su-prop>
        <su-prop label="监理企业">{{detailData.jlqy || ''}}</su-prop>
		<su-prop label="项目监理">{{detailData.xmjl || ''}}</su-prop>
      </su-prop-group>
      <su-prop-group title="进度信息" v-if="detailData">
        <su-prop label="形象进度">{{detailData.xxjd || ''}}</su-prop>
        <su-prop label="填报时间">{{detailData.tbsj || ''}}</su-prop>
        <su-prop label="本月完成产值">{{detailData.byywccz || ''}}</su-prop>
        <su-prop label="本月实现税收">{{detailData.byysxss || ''}}</su-prop>
        <su-prop label="累计完成产值">{{detailData.ljwccz || ''}}</su-prop>
        <su-prop label="累计实现税收">{{detailData.ljsxss || ''}}</su-prop>
      </su-prop-group>
     <su-prop-group title="现场照片">
     <su-prop-group  v-for="(item,index) in arr">
        <image lazy-load class="su-fit-image" :src="item.src" mode="aspectFill" @click="previewImg(item.src)"></image>
     </su-prop-group>
        </su-prop-group>
     <su-prop-group title="税票">
     		  <su-prop-group  v-for="(item,index) in sparr">
        <image lazy-load class="su-fit-image" :src="item.src" mode="aspectFill" @click="previewImg(item.src)"></image>
     </su-prop-group>
     </su-prop-group>
      <!-- loading -->
      <su-list-loading :loading="detailLoading"></su-list-loading>
    </su-body>
  </su-page>
</template>

<script>
  /**
   * @description 详情
   * @date 2022-03-12
   * @version v1.0.1
   * @author gf
   */
  import {
    mapState
  } from 'vuex'
  import {runSQL} from '@/common/utils/wxutils.js'
  export default {
    data() {
      return {
        id:'',
		arr:null,
		sparr:null,
        detailData: null,
        detailLoading: false
      }
    },
    computed: {
      ...mapState(['token'])
    },
    onLoad(params) {
      this.id = params.id || ''
      this.getDetail(params.id)
    },
    watch: {
      token(newVal) {
        this.getDetail()
      }
    },
    methods: {
      // 获取详情
      getDetail(a) {
		
		   uni.request({
		       url:'http://120.221.95.208:8083/HdzjAppport/seljdtp?zdmc=fjid&uuid='+a,
		       method:'get',
		       success:res=>{
		           console.log(res.data);
		           if(res.data.length>0){
		   					  let list=[];
		   					  for(let i=0;i<res.data.length;i++){
		   						  let ai="data:image/jpeg;base64,"+res.data[i];
		   						  list.push({
		   							   src:ai
		   						  })
		   					  }
		   					  this.arr=list;
		   				
		   				  }
		       }
		   })
		   uni.request({
		       url:'http://120.221.95.208:8083/HdzjAppport/seljdtp?zdmc=spfp&uuid='+a,
		       method:'get',
		       success:res=>{
		           console.log(res.data);
		           if(res.data.length>0){
		   					  let list=[];
		   					  for(let i=0;i<res.data.length;i++){
		   						  let ai="data:image/jpeg;base64,"+res.data[i];
		   						  list.push({
		   							   src:ai
		   						  })
		   					  }
		   					  this.sparr=list;
		   				
		   				  }
		       }
		   })
		   
let list=[];
		   runSQL("select a.fzrlxfs,d.jsdw,a.gcmc,a.gcdz,a.sjkgsj,a.gczt,a.zcbqymc,a.zcbxmfzr,a.jlqymc,a.jlfzr,c.tbsj,c.xxjd,c.BYYWCCZ,c.BYYSXSS,c.LJWCCZ,c.LJSXSS,c.fjid from ssnydw.gcbdxxb a,ssnydw.GCJDMYXXB b,ssnydw.MYJDXXFB c,ssnydw.jzgcb d where a.gcbh=d.gcbh and a.gcbh=b.gcbh and b.recid=c.recid and c.uuid='"+a+"';").then(res=>{
        this.detailLoading = true
        setTimeout(() => {
          this.detailLoading = false
          this.detailData = {
            image:'http://120.221.95.208:8082/xhaxq/doc/slideshow.jsp?recId=220738&showFolder=0&downloadRight=1&selected=E37135962BC44E55B7B01051BA75C568&files=E37135962BC44E55B7B01051BA75C568&docAdd=1&fetchFrom=fileField&theme=default&appCode=gcjg&appId=0',
            gcmc:res[0][0].GCMC,
            dizhi:res[0][0].GCDZ,
            jsdw:res[0][0].JSDW,
            zhuangtai:res[0][0].GCZT,
            kgsj:res[0][0].SJKGSJ,
			zbqy:res[0][0].ZCBQYMC,
		    zbfzr:res[0][0].ZCBXMFZR,
			lxfs:res[0][0].FZRLXFS,
			jlqy:res[0][0].JLQYMC,
            xmjl:res[0][0].JLFZR,
            xxjd:res[0][0].XXJD,
            tbsj:res[0][0].TBSJ,
			byywccz:res[0][0].BYYWCCZ,
			byysxss:res[0][0].BYYSXSS,
			ljwccz:res[0][0].LJWCCZ,
			ljsxss:res[0][0].LJSXSS,
          }
        }, 300)
		})
      },
	  previewImg(logourl) {
	   let _this = this;
	   let imgsArray = [];
	   imgsArray[0] = logourl
	   uni.previewImage({
	   current: 0,
	   urls: imgsArray
	   });
	   },
	    
	  }
    }
	
  
</script>

<style lang="scss">
</style>
